package org.bt4girls.common.model.result;

import lombok.Data;

@Data
public class ServiceResult<T> {
    private boolean status;
    private ErrorCode exception;
    private T data;

    public ServiceResult(boolean status, ErrorCode exception, T data) {
        this.status = status;
        this.exception = exception;
        this.data = data;
    }

    public static <Y> ServiceResult<Y> success(Y data) {
        return new ServiceResult<Y>(true, null, data);
    }

    public static <Y> ServiceResult<Y> exception(ErrorCode code, Y data) {
        return new ServiceResult<Y>(false, code, data);
    }


}
